package com.fitns.user.mapper.baseConfig;

import static org.mybatis.dynamic.sql.SqlBuilder.*;

import com.fitns.user.model.baseConfig.TbWarnConfig;

import java.util.List;
import javax.annotation.Generated;

import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.SqlBuilder;
import org.mybatis.dynamic.sql.delete.DeleteDSL;
import org.mybatis.dynamic.sql.delete.MyBatis3DeleteModelAdapter;
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
import org.mybatis.dynamic.sql.render.RenderingStrategy;
import org.mybatis.dynamic.sql.select.MyBatis3SelectModelAdapter;
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
import org.mybatis.dynamic.sql.select.SelectDSL;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.MyBatis3UpdateModelAdapter;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;

@Mapper
public interface TbWarnConfigMapper {
    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    long count(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @DeleteProvider(type=SqlProviderAdapter.class, method="delete")
    int delete(DeleteStatementProvider deleteStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @InsertProvider(type=SqlProviderAdapter.class, method="insert")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="record.id", before=false, resultType=Long.class)
    int insert(InsertStatementProvider<TbWarnConfig> insertStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @ResultMap("TbWarnConfigResult")
    TbWarnConfig selectOne(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @Results(id="TbWarnConfigResult", value = {
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="ranges", property="ranges", jdbcType=JdbcType.VARCHAR),
        @Result(column="way", property="way", jdbcType=JdbcType.VARCHAR),
        @Result(column="direct", property="direct", jdbcType=JdbcType.INTEGER),
        @Result(column="greater_than", property="greaterThan", jdbcType=JdbcType.REAL),
        @Result(column="less_than", property="lessThan", jdbcType=JdbcType.REAL),
        @Result(column="apply", property="apply", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="modify_time", property="modifyTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_id", property="createId", jdbcType=JdbcType.BIGINT),
        @Result(column="modify_id", property="modifyId", jdbcType=JdbcType.BIGINT)
    })
    List<TbWarnConfig> selectMany(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @UpdateProvider(type=SqlProviderAdapter.class, method="update")
    int update(UpdateStatementProvider updateStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<Long>> countByExample() {
        return SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
                .from(TbWarnConfigDynamicSqlSupport.tbWarnConfig);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default DeleteDSL<MyBatis3DeleteModelAdapter<Integer>> deleteByExample() {
        return DeleteDSL.deleteFromWithMapper(this::delete, TbWarnConfigDynamicSqlSupport.tbWarnConfig);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int deleteByPrimaryKey(Long id_) {
        return DeleteDSL.deleteFromWithMapper(this::delete, TbWarnConfigDynamicSqlSupport.tbWarnConfig)
                .where(TbWarnConfigDynamicSqlSupport.id, isEqualTo(id_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insert(TbWarnConfig record) {
        return insert(SqlBuilder.insert(record)
                .into(TbWarnConfigDynamicSqlSupport.tbWarnConfig)
                .map(TbWarnConfigDynamicSqlSupport.name).toProperty("name")
                .map(TbWarnConfigDynamicSqlSupport.ranges).toProperty("ranges")
                .map(TbWarnConfigDynamicSqlSupport.way).toProperty("way")
                .map(TbWarnConfigDynamicSqlSupport.direct).toProperty("direct")
                .map(TbWarnConfigDynamicSqlSupport.greaterThan).toProperty("greaterThan")
                .map(TbWarnConfigDynamicSqlSupport.lessThan).toProperty("lessThan")
                .map(TbWarnConfigDynamicSqlSupport.apply).toProperty("apply")
                .map(TbWarnConfigDynamicSqlSupport.createTime).toProperty("createTime")
                .map(TbWarnConfigDynamicSqlSupport.modifyTime).toProperty("modifyTime")
                .map(TbWarnConfigDynamicSqlSupport.createId).toProperty("createId")
                .map(TbWarnConfigDynamicSqlSupport.modifyId).toProperty("modifyId")
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insertSelective(TbWarnConfig record) {
        return insert(SqlBuilder.insert(record)
                .into(TbWarnConfigDynamicSqlSupport.tbWarnConfig)
                .map(TbWarnConfigDynamicSqlSupport.name).toPropertyWhenPresent("name", record::getName)
                .map(TbWarnConfigDynamicSqlSupport.ranges).toPropertyWhenPresent("ranges", record::getRanges)
                .map(TbWarnConfigDynamicSqlSupport.way).toPropertyWhenPresent("way", record::getWay)
                .map(TbWarnConfigDynamicSqlSupport.direct).toPropertyWhenPresent("direct", record::getDirect)
                .map(TbWarnConfigDynamicSqlSupport.greaterThan).toPropertyWhenPresent("greaterThan", record::getGreaterThan)
                .map(TbWarnConfigDynamicSqlSupport.lessThan).toPropertyWhenPresent("lessThan", record::getLessThan)
                .map(TbWarnConfigDynamicSqlSupport.apply).toPropertyWhenPresent("apply", record::getApply)
                .map(TbWarnConfigDynamicSqlSupport.createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
                .map(TbWarnConfigDynamicSqlSupport.modifyTime).toPropertyWhenPresent("modifyTime", record::getModifyTime)
                .map(TbWarnConfigDynamicSqlSupport.createId).toPropertyWhenPresent("createId", record::getCreateId)
                .map(TbWarnConfigDynamicSqlSupport.modifyId).toPropertyWhenPresent("modifyId", record::getModifyId)
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbWarnConfig>>> selectByExample() {
        return SelectDSL.selectWithMapper(this::selectMany, TbWarnConfigDynamicSqlSupport.id, TbWarnConfigDynamicSqlSupport.name, TbWarnConfigDynamicSqlSupport.ranges, TbWarnConfigDynamicSqlSupport.way, TbWarnConfigDynamicSqlSupport.direct, TbWarnConfigDynamicSqlSupport.greaterThan, TbWarnConfigDynamicSqlSupport.lessThan, TbWarnConfigDynamicSqlSupport.apply, TbWarnConfigDynamicSqlSupport.createTime, TbWarnConfigDynamicSqlSupport.modifyTime, TbWarnConfigDynamicSqlSupport.createId, TbWarnConfigDynamicSqlSupport.modifyId)
                .from(TbWarnConfigDynamicSqlSupport.tbWarnConfig);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbWarnConfig>>> selectDistinctByExample() {
        return SelectDSL.selectDistinctWithMapper(this::selectMany, TbWarnConfigDynamicSqlSupport.id, TbWarnConfigDynamicSqlSupport.name, TbWarnConfigDynamicSqlSupport.ranges, TbWarnConfigDynamicSqlSupport.way, TbWarnConfigDynamicSqlSupport.direct, TbWarnConfigDynamicSqlSupport.greaterThan, TbWarnConfigDynamicSqlSupport.lessThan, TbWarnConfigDynamicSqlSupport.apply, TbWarnConfigDynamicSqlSupport.createTime, TbWarnConfigDynamicSqlSupport.modifyTime, TbWarnConfigDynamicSqlSupport.createId, TbWarnConfigDynamicSqlSupport.modifyId)
                .from(TbWarnConfigDynamicSqlSupport.tbWarnConfig);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default TbWarnConfig selectByPrimaryKey(Long id_) {
        return SelectDSL.selectWithMapper(this::selectOne, TbWarnConfigDynamicSqlSupport.id, TbWarnConfigDynamicSqlSupport.name, TbWarnConfigDynamicSqlSupport.ranges, TbWarnConfigDynamicSqlSupport.way, TbWarnConfigDynamicSqlSupport.direct, TbWarnConfigDynamicSqlSupport.greaterThan, TbWarnConfigDynamicSqlSupport.lessThan, TbWarnConfigDynamicSqlSupport.apply, TbWarnConfigDynamicSqlSupport.createTime, TbWarnConfigDynamicSqlSupport.modifyTime, TbWarnConfigDynamicSqlSupport.createId, TbWarnConfigDynamicSqlSupport.modifyId)
                .from(TbWarnConfigDynamicSqlSupport.tbWarnConfig)
                .where(TbWarnConfigDynamicSqlSupport.id, isEqualTo(id_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExample(TbWarnConfig record) {
        return UpdateDSL.updateWithMapper(this::update, TbWarnConfigDynamicSqlSupport.tbWarnConfig)
                .set(TbWarnConfigDynamicSqlSupport.name).equalTo(record::getName)
                .set(TbWarnConfigDynamicSqlSupport.ranges).equalTo(record::getRanges)
                .set(TbWarnConfigDynamicSqlSupport.way).equalTo(record::getWay)
                .set(TbWarnConfigDynamicSqlSupport.direct).equalTo(record::getDirect)
                .set(TbWarnConfigDynamicSqlSupport.greaterThan).equalTo(record::getGreaterThan)
                .set(TbWarnConfigDynamicSqlSupport.lessThan).equalTo(record::getLessThan)
                .set(TbWarnConfigDynamicSqlSupport.apply).equalTo(record::getApply)
                .set(TbWarnConfigDynamicSqlSupport.createTime).equalTo(record::getCreateTime)
                .set(TbWarnConfigDynamicSqlSupport.modifyTime).equalTo(record::getModifyTime)
                .set(TbWarnConfigDynamicSqlSupport.createId).equalTo(record::getCreateId)
                .set(TbWarnConfigDynamicSqlSupport.modifyId).equalTo(record::getModifyId);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(TbWarnConfig record) {
        return UpdateDSL.updateWithMapper(this::update, TbWarnConfigDynamicSqlSupport.tbWarnConfig)
                .set(TbWarnConfigDynamicSqlSupport.name).equalToWhenPresent(record::getName)
                .set(TbWarnConfigDynamicSqlSupport.ranges).equalToWhenPresent(record::getRanges)
                .set(TbWarnConfigDynamicSqlSupport.way).equalToWhenPresent(record::getWay)
                .set(TbWarnConfigDynamicSqlSupport.direct).equalToWhenPresent(record::getDirect)
                .set(TbWarnConfigDynamicSqlSupport.greaterThan).equalToWhenPresent(record::getGreaterThan)
                .set(TbWarnConfigDynamicSqlSupport.lessThan).equalToWhenPresent(record::getLessThan)
                .set(TbWarnConfigDynamicSqlSupport.apply).equalToWhenPresent(record::getApply)
                .set(TbWarnConfigDynamicSqlSupport.createTime).equalToWhenPresent(record::getCreateTime)
                .set(TbWarnConfigDynamicSqlSupport.modifyTime).equalToWhenPresent(record::getModifyTime)
                .set(TbWarnConfigDynamicSqlSupport.createId).equalToWhenPresent(record::getCreateId)
                .set(TbWarnConfigDynamicSqlSupport.modifyId).equalToWhenPresent(record::getModifyId);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKey(TbWarnConfig record) {
        return UpdateDSL.updateWithMapper(this::update, TbWarnConfigDynamicSqlSupport.tbWarnConfig)
                .set(TbWarnConfigDynamicSqlSupport.name).equalTo(record::getName)
                .set(TbWarnConfigDynamicSqlSupport.ranges).equalTo(record::getRanges)
                .set(TbWarnConfigDynamicSqlSupport.way).equalTo(record::getWay)
                .set(TbWarnConfigDynamicSqlSupport.direct).equalTo(record::getDirect)
                .set(TbWarnConfigDynamicSqlSupport.greaterThan).equalTo(record::getGreaterThan)
                .set(TbWarnConfigDynamicSqlSupport.lessThan).equalTo(record::getLessThan)
                .set(TbWarnConfigDynamicSqlSupport.apply).equalTo(record::getApply)
                .set(TbWarnConfigDynamicSqlSupport.createTime).equalTo(record::getCreateTime)
                .set(TbWarnConfigDynamicSqlSupport.modifyTime).equalTo(record::getModifyTime)
                .set(TbWarnConfigDynamicSqlSupport.createId).equalTo(record::getCreateId)
                .set(TbWarnConfigDynamicSqlSupport.modifyId).equalTo(record::getModifyId)
                .where(TbWarnConfigDynamicSqlSupport.id, isEqualTo(record::getId))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKeySelective(TbWarnConfig record) {
        return UpdateDSL.updateWithMapper(this::update, TbWarnConfigDynamicSqlSupport.tbWarnConfig)
                .set(TbWarnConfigDynamicSqlSupport.name).equalToWhenPresent(record::getName)
                .set(TbWarnConfigDynamicSqlSupport.ranges).equalToWhenPresent(record::getRanges)
                .set(TbWarnConfigDynamicSqlSupport.way).equalToWhenPresent(record::getWay)
                .set(TbWarnConfigDynamicSqlSupport.direct).equalToWhenPresent(record::getDirect)
                .set(TbWarnConfigDynamicSqlSupport.greaterThan).equalToWhenPresent(record::getGreaterThan)
                .set(TbWarnConfigDynamicSqlSupport.lessThan).equalToWhenPresent(record::getLessThan)
                .set(TbWarnConfigDynamicSqlSupport.apply).equalToWhenPresent(record::getApply)
                .set(TbWarnConfigDynamicSqlSupport.createTime).equalToWhenPresent(record::getCreateTime)
                .set(TbWarnConfigDynamicSqlSupport.modifyTime).equalToWhenPresent(record::getModifyTime)
                .set(TbWarnConfigDynamicSqlSupport.createId).equalToWhenPresent(record::getCreateId)
                .set(TbWarnConfigDynamicSqlSupport.modifyId).equalToWhenPresent(record::getModifyId)
                .where(TbWarnConfigDynamicSqlSupport.id, isEqualTo(record::getId))
                .build()
                .execute();
    }
}